namespace GeovinDu.PdfViewer{ [DefaultProperty("FilePath")] [ToolboxData("<{0}:ShowPdf runat=server> ")] public class ShowPdf : WebControl { #region "Declarations" //Geovin Du 塗聚文 20131010 private string mFilePath;#endregion #region "Properties" [Category("Source File")] [Browsable(true)] [Description("Set path to source file.")] [Editor(typeof(System.Web.UI.Design.UrlEditor), typeof(System.Drawing.Design.UITypeEditor))] public string FilePath { get { return mFilePath; } set { if (value == string.Empty) { mFilePath = string.Empty; } else { int tilde = -1; tilde = value.IndexOf('~'); if (tilde != -1) { mFilePath = value.Substring((tilde + 2)).Trim(); } else { mFilePath = value; } } } } // end FilePath property#endregion #region "Rendering" ////// Geovin Du 塗聚文 20131010 /// /// protected override void RenderContents(HtmlTextWriter writer) { try { StringBuilder sb = new StringBuilder(); sb.Append(""); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.Write(sb.ToString()); writer.RenderEndTag(); } catch { // with no properties set, this will render "Display PDF Control" in a // a box on the page writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.Write("Display PDF Control"); writer.RenderEndTag(); } // end try-catch } // end RenderContents #endregion } // end class} // end namespace Geovin Du 塗聚文 20131010